package com.MuApk.box;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.app.*;
import android.os.*;
import java.lang.reflect.*;

public class SecretCodeReceiver extends Service
{
	@Override
	public IBinder onBind(Intent intent)
	{
		// TODO: Implement this method
		return null;
	}
}

public class SecretCodeReceiver extends BroadcastReceiver
{

    private static final String MY_SECRET_CODE = "32767";

    @Override
    public void onReceive(Context context, Intent intent)
	{
        String action = intent.getAction();

        Log.d("HH", "getAction:" + action);

        if ("android.provider.Telephony.SECRET_CODE".equals(action))
		{
            String host = (intent.getData() == null) ? null : intent.getData().getHost();

            if (MY_SECRET_CODE.equals(host))
			{
                Log.d("HH", "do secret operate ...");
                Intent target = new Intent();
                target.setClassName("com.MuApk.box", "com.MuApk.box.MainActivity");
                target.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                try
				{
                    context.startActivity(target);
                }
				catch (Exception e)
				{
                    Log.e("HH", "exception " + e);
                }
            }
        }
    }
}





/*package com.MuApk.box;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.MuApk.box.MainActivity;

public class SecretCodeReceiver extends BroadcastReceiver
{
	public SecretCodeReceiver()
	{
	}

	@Override
	public void onReceive(Context context, Intent intent)
	{
		Intent activityIntent = new Intent(context, MainActivity.class);
		activityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
		context.startActivity(activityIntent);
	}
}
*/
